import './loading.css'

const newLocal = `<div><span></span></div>
                  <div><span></span></div>
                  <div><span></span></div>
                  <div><span></span></div>`

const loading = {
  target: null,
  init () {
    let div = document.createElement('div')
    div.className = 'loading-wp'
    div.innerHTML = newLocal
    document.body.appendChild(div)
    this.target = div
  },
  show () {
    if (!this.target) {
      this.init()
    }
    this.target.style.display = 'block'
  },
  hide () {
    this.target.style.display = 'none'
  }
}

export default loading
